﻿using System.Threading;
using System;

namespace PortableTPL
{
    public abstract class TaskScheduler : IDisposable
    {
        public static int ProcessorCount { get; set; }

        static TaskScheduler()
        {
            ProcessorCount = 2;
        }

        public abstract void EnqueueTask(Task task);

        public static TaskScheduler FromCurrentSynchronizationContext()
        {
            return new SynchronisationContextTaskScheduler(SynchronizationContext.Current);
        }

        public abstract void Dispose();
    }
}
